package com.example.bootspi;

import java.util.Properties;

/**
 * 拓展nacos配置
 *
 * @author ben
 * @since 2022/5/22
 */
public class NacosConfigExtension implements BootExtension {

    @Override
    public void extension() {
        Properties properties = System.getProperties();
        // nacos 地址配置
        properties.setProperty("spring.cloud.nacos.discovery.server-addr", "localhost:8848");
        properties.setProperty("spring.cloud.nacos.discovery.namespace", "7443f32e-6e48-4f80-8c27-f9281f649cd8");
        properties.setProperty("spring.cloud.nacos.config.server-addr", "localhost:8848");
        properties.setProperty("spring.cloud.nacos.config.namespace", "7443f32e-6e48-4f80-8c27-f9281f649cd8");
        // 关闭springcloud的兼容性校验，demo只是为了验证SPI的功能
        properties.setProperty("spring.cloud.compatibility-verifier.enabled", "false");
    }
}
